namespace bootsy.cli

import System
import Bootsy.Skype
import Bootsy.Jira
import Boo.Lang.Useful.CommandLine

[MTAThread]
def Main(argv as (string)):
	print "bootsy-cli - command line interface for the bootsy bot framework"
	try:
		StartService(CommandLine(argv))
	except x as CommandLineException:
		return OnCommandLineException(x)
	except x:
		print x	

def StartService(cmdLine as CommandLine):	
	
	jiraBot = JiraBot(
				JiraService(
					JiraServiceConfiguration(cmdLine.JiraLogin, cmdLine.JiraPassword)))
	service = SkypeChatService()
	service.RegisterParticipant(jiraBot)
	service.RegisterParticipant(Bootsy.Dict.DictBot())
	service.RegisterParticipant(Bootsy.Voting.VotingBot())
	service.Start()
	prompt("Press <ENTER> to finish")
	
def OnCommandLineException(x as CommandLineException):
	print "ERROR:", x.Message
	CommandLine().PrintOptions()
	return -1
